home *** CD-ROM | disk | FTP | other *** search
/ AOL File Library: 4,101 to 4,200 / aol-file-protocol-4400-4101-to-4200.zip / AOLDLs / ADV - Articles & Misc / Manual for ProDev DDT8_DDT16 / DDT.MANUAL.bxy / DDT.Manual / CHAPTER.6 (.txt) < prev    next >
AppleWorks Document  |  1993-08-05  |  15KB  |  272 lines

  1. O=====<====<====<====<====<====<====<====<====<====<====<====<====<====<====<===
  2. O=====<====<====<====<====<====<====<====<====<====<====<====<====<====<====<===
  3. CHAPTER 6
  4. TRACING AND RUNNING
  5. GO [A] - RUN
  6. BThe GO command is used to start real time execution of the target I
  7. Gprogram. If no address is specified in the command then execution will L
  8. Jbegin at the current program counter location. If the optional address is A
  9. present, program execution will begin at the indicated address.
  10. EXAMPLE
  11. DLet's assume that you have a program in memory, starting at address 3
  12. $2000.  Now, run the program from the ProDev DDT.
  13. :GO 2000
  14.       {Begin full speed execution at location $2000
  15. ST [N] - STEP
  16. IThe STEP command allows you to execute instructions one at a time. After K
  17. Ieach instruction is executed your program is interrupted and the DISPLAY K
  18. IREGISTERS command is executed. The instruction which is displayed is the 
  19. next that will be executed.
  20. JThe number of instructions to step is indicated by "[N]" and is optional. F
  21. DIf no number is input then "1" is assumed. If zero is input, 65,536 L
  22. Jinstructions will be stepped unless paused by the "KEY" value (default is E
  23. C<ctrl>-S). Pressing "esc" will cancel the step, any other key will 
  24. continue.
  25. JOnce the STEP command is invoked, the prompt will change from ":" to "T:" J
  26. Hto indicate the 'Trace/Step' mode is active. When the 'Trace/Step' mode L
  27. Jis active it is only necessary to press the "Return" key to trace or step F
  28. Dthe current instruction. The 'Trace/Step' mode remains active until +
  29. canceled by entering a different command.
  30. HIf you are stepping more than one instruction (E.G. ST 5) and a SOFT or J
  31. HHARD  BREAK is encountered, the stepping will stop. To continue, simply L
  32. Jenter the STEP command again. If a HARD BREAK is encountered it will show H
  33. Fup twice. Once at the instruction where it was placed and once at the I
  34. Gfollowing instruction. This is normal and is caused by the way the CPU 
  35. pre-fetches instructions.
  36. EXAMPLE {DDT8}
  37. Step the program that was entered in the "MA" command description.
  38. :PC=2000
  39.      {set the program counter}
  40. A=00 X=00 Y=00 S=E0 M=0A L=0 P=--1-----D
  41. 00/2000:A9 00       LDA #00
  42.      {this instruction will be traced
  43.   {invoke the step command}D
  44. A=00 X=00 Y=00 S=E0 M=0A L=0 P=--1---Z-
  45.    {A = 00 and Z flag setE
  46. 00/2002:85 06       STA 06
  47.         {next instruction to be stepped8
  48.   {Press "Return" to trace the STA 06 instruction}*
  49. A=00 X=00 Y=00 S=E0 M=0A L=0 P=--1---Z-
  50. 00/2004:A9 30       LDA #30
  51. A=30 X=00 Y=00 S=E0 M=0A L=0 P=--1-----
  52.    {A = 30 and Z cleared
  53. 00/2006:85 07       STA 07
  54. A=30 X=00 Y=00 S=E0 M=0A L=0 P=--1-----
  55. 00/2008:A0 01       LDY #01
  56. A=30 X=00 Y=01 S=E0 M=0A L=0 P=--1-----
  57.   {Y = 01D
  58. 00/200A:B1 06       LDA (06),Y {003001
  59.   {effective address $3001
  60. A=00 X=00 Y=01 S=E0 M=0A L=0 P=--1---Z-
  61.   { $3001 was 00
  62. 00/200C:AA          TAX
  63. HNote! Remember all numbers input to the ProDev DDT are assumed to be in I
  64. Ghexadecimal format. If you wanted to step 10 decimal instructions, you K
  65. Iwould enter the command "ST !10". The exclamation point must precede all I
  66. Gdecimal numbers. If you entered the command "ST 10" you would step the <
  67. next 16 decimal instructions (E.G. 10 = $10 = 16 decimal).
  68. TR [N] - TRACE
  69. GThe TRACE command is identical to the step command in operation except H
  70. Ffor the information displayed. The TRACE command does not display the L
  71. Jregister contents. This is done to allow more program steps to fit on the 
  72. screen while tracing.
  73. TS A - TRACE WITH SUB
  74. IThe TRACE WITH SUBROUTINE command is the most flexible of all the ProDev L
  75. JDDT's commands. This command allows you to write your own subroutine that G
  76. Eis executed after each instruction of the target program. The target I
  77. Gprogram is stopped when your testing subroutine returns with the Carry 3
  78. flag set. Entering "esc" will cancel the command.
  79. IYour subroutine may be placed anywhere in system RAM that is not used by J
  80. the target program. The location of your subroutine is indicated by "A" 
  81. Fin the command description and is mandatory. Your subroutine lets the J
  82. HProDev DDT know when you wish to stop the target program by setting the I
  83. GCARRY flag (C=1) of the processor status register. When the ProDev DDT F
  84. Dsees that your test subroutine has set the CARRY flag, it stops the K
  85. Itarget program and gives you control. All of the processor registers are G
  86. Eavailable  for use in your subroutine, without fear of affecting the J
  87. Hoperation of the target program. You should not use memory locations as I
  88. Gstorage unless you are absolutely sure the target program does not use D
  89. them. Several examples of test subroutines are given in Chapter 9.
  90. KIMPORTANT!  Make sure the program counter is properly set before entering  I
  91. Gthe TRACE WITH SUB command. The target program will begin execution at H
  92. Fthe current location of the program counter as soon as the command is 
  93. entered.
  94. I{DDT16} Bank numbers may be specified for the test subroutine. Your test :
  95. subroutine is entered via "JSL" and must end with "RTL".
  96. EXAMPLE
  97. GUse the TRACE WITH SUB command to determine when memory location $3002 H
  98. Freaches a value of $80, when executing the program described with the 
  99. Mini-Assembler command.
  100. HUse the Mini-Assembler to enter the following test subroutine at memory 
  101. location $2800.
  102. 2800-    LDA $3002  ;load the accumulator with location $3002:
  103. 2803-    CMP #$80   ;has location $3002 reached $80 yet?5
  104. 2805-    BEQ $280B  ;it is $80, set CARRY and leave8
  105. 2807-    CLC        ;not $80 yet, clear the CARRY flag"
  106. 2808-    BCC $280B  ; and return:
  107. 280A-    SEC        ;yes it is $80 so set the CARRY flag/
  108. 280B-    RTS        ;return to the ProDev DDT
  109. :PC=  $2000
  110.    {Set the program counter to a good location}
  111. :TS 2800
  112.     {Now enter the TRACE WITH SUB command.}*
  113. A=00 X=80 Y=01 S=E0 M=0A L=0 P=N-1-----
  114. 00/2010:E8          INX
  115. GThe target program was interrupted when location $3002 reached $80. To G
  116. verify this, use the MEMORY MODIFY command to examine location $3002.
  117. :MM 3002
  118. 00/3002: 80
  119.   {memory location $3002 does contain $80}
  120. BAs you can see the possible uses for this command are practically 
  121. limitless.
  122. FNote! The execution time of the target program will be increased when I
  123. Gusing this command. This is caused by the added steps required to save L
  124. Jall the registers after each instruction of the target program and by the L
  125. Jtime required to run your subroutine. So don't be too alarmed if it takes .
  126. a few seconds before the program is stopped.
  127. EX [N] - EXECUTE
  128. JThe EXECUTE command is very similar to the TRACE command with one obvious H
  129. Fexception.  The processor registers are displayed only after the last I
  130. Ginstruction has been executed. For example, if you entered the command J
  131. H"EX 1" it would be the same as entering the TRACE command "TR or TR 1". K
  132. IHowever, if you enter the command "EX
  133. !10", then the next 9 instructions I
  134. Gof the program would be executed with nothing being displayed and only L
  135. Jafter the tenth instruction was executed would the processor registers be H
  136. Fdisplayed. This greatly increases the speed with which the program is I
  137. Gexecuted and makes it more convenient to run through large sections of 
  138. code.
  139. DIf you invoke the EXECUTE command with N = 0 (E.G. EX 0) the target J
  140. Hprogram will continue to execute until you stop it.  Pressing the pause L
  141. J"KEY" (default is <ctrl>-S) will pause the execution of the program until E
  142. Canother key is pressed. While paused, pressing "esc" will stop the 8
  143. program from executing and cancel the EXECUTE command.
  144. JThis command can be very useful for debugging graphic animation routines. H
  145. FWhen invoked, the target program will execute at a much slower speed, I
  146. Gthereby allowing you to see the animation steps as they proceed and to L
  147. Jstop the target program at any point. This can also be useful if you wish K
  148. to examine the methods used by other programs to perform their animation.
  149. ***** SPECIAL NOTE *****
  150. CThe ProDev DDT was never intended to be used as a tool for copying G
  151. Eprotected software or to break copy protection codes. Any use of the F
  152. DProDev DDT for these purposes may be illegal and is not promoted or !
  153. supported by ProDev in any way.
  154. EXAMPLE
  155. :PC= $2000
  156.     {position the program counter}
  157. :EX !10
  158.        {execute the next 10 decimal instructions}*
  159. A=00 X=01 Y=01 S=E0 M=0A L=0 P=--1-----
  160. 00/200D:8E 02 30    STX 3002
  161.    {Ten instructions were executed and the program was stopped
  162. ER - EXECUTE TO RTS
  163. BThe EXECUTE TO RTS command will cause the target program to begin J
  164. Hexecuting at the current program counter location and continue until an K
  165. IRTS instruction is found. This can be very useful when you are tracing a :
  166. program in which you know the subroutines work properly.
  167. JIMPORTANT!  Make sure the program counter is properly set before entering G
  168. Ethe EXECUTE TO RTS command. Your program will begin execution at the D
  169. Bcurrent location of the program counter as soon as the command is 
  170. entered.
  171. EXAMPLE
  172. Use the subroutine described in the TRACE WITH SUB command.
  173. :PC= 2800
  174.     {set the program counter}
  175. A=00 X=01 Y=01 X=E0 M=0A L=0 P=N-1-----
  176. 00/2809:60          RTS
  177.       {the program runs until the RTS is found}
  178. HNote! Subroutines may be called from within subroutines, in which case, L
  179. Jthe ProDev DDT will stop at the 1st RTS/RTL it sees. Simply enter "ER" to 
  180. continue to the next RTS/RTL.
  181. ET A.A - EXECUTION TIME
  182. HThe EXECUTION TIME command displays the number of clock cycles required D
  183. Bto  execute the code between two inclusive addresses. The command J
  184. Hactivates a  hardware device on the ProDev DDT card which actually runs I
  185. Gthe specified code and counts the number of clock cycles required. The H
  186. Fcounter has a limit of $FFFF or 65,535. If this limit is exceeded the #
  187. counter will start over at $0000.
  188. The addresses may not contain a bank number.
  189. G{DDT8} The various bank switches will be used to determine the bank of J
  190. Hthe instructions. In other words, if you enter the command "ET 800.802" D
  191. Band you have set the memory switches to read from AUX memory, the K
  192. Iexecution time will be performed on the instructions in auxiliary memory 
  193. from $800 to $802 inclusive.
  194. {DDT16} The current program bank will be used.
  195. HThis command can be very useful for writing delay loops and for writing G
  196. Etime critical code. The output is in the form of the number of clock L
  197. Jcycles required to execute the code. To make a fairly accurate conversion C
  198. Ato  seconds, multiply the number of clock cycles by 0.9775
  199. (0.0000009775).
  200. F{DDT16} This command should only be used with the system clock set to K
  201. INORMAL (1Mhz). If the system clock is set to FAST then "(x
  202. ~2.6) will be J
  203. Hdisplayed along with the number of NORMAL (1Mhz) clock cycles that were D
  204. Brequired. (x ~2.6) indicates that the number of FAST clock cycles H
  205. Frequired is approximately 2.6 times the number of NORMAL clock cycles 
  206. displayed.
  207. * ADVANCED NOTE
  208. EThe 1Mhz system clock of the Apple computer does not have a constant F
  209. Dperiod of   977.5 nS. The clock cycles are periodically extended by F
  210. Dapproximately 140nS. These extended clock cycles must be taken into K
  211. Iaccount if you are trying to develop an extremely accurate software time F
  212. base. The ProDev DDT does not treat these extended clock cycles any 
  213. Fdifferently than the standard clock cycle. There are quite a few good K
  214. Ibooks on Apple hardware which describe the system timing and we will not 
  215. attempt to do so here.
  216. EXAMPLE
  217. IReferring to the program which we previously described in the TRACE WITH 
  218. SUB command at address $2800.
  219. HHow many clock cycles are required to execute the LDA $3002 instruction 
  220. at address $2800?
  221. :ET 2800.28008
  222. CLOCK CYCLES = $0004
  223.     {four clock cycles required}
  224. GHow many clock cycles are required to execute the program from address -
  225. $2800 inclusive to address $2809 inclusive?
  226. :ET 2800.2809=
  227. CLOCK CYCLES = $0011
  228.     {$11 or 17 clock cycles required}
  229. RT - REAL TIME
  230. BIf the current instruction is a "JSR" then execute the program in G
  231. Ereal-time until the instruction following the "JSR" is reached. This C
  232. Acommand is simply a one time version of the T range as described C
  233. Apreviously in the Protection Window description. The instruction I
  234. Gfollowing the "JSR" must reside in RAM so a break can be automatically H
  235. Fplaced there to halt the program after the real-time execution of the E
  236. Csubroutine. This instruction also works with the special case of a B
  237. @ProDOS8 & ProDOS16 MLI call by placing the break beyond the MLI I
  238. Gparameters. If you are using a similar technique for parameter passing 9
  239. then the "RT" or "T range" commands should not be used.
  240. I{DDT16} Also works with "JSL" "RTL" when in native mode. DO NOT use "RT" :
  241. or "T" range commands with a JSR when in emulation mode.
  242.      EXAMPLE
  243.      If the current instruction is:
  244.      00/2000:20 DD FB    JSR FBDD
  245. GEntering the command "RT" will result in the subroutine at $FBDD being I
  246. Gexecuted in real-time. In this case $FBDD is the Apple ROM's ring bell I
  247. Groutine. The bell will ring and control will be returned to the ProDev +
  248. DDT at the instruction following the JSR.
  249.      00/2003:EA          NOP   or whatever.
  250. down - SKIP THE CURRENT INSTRUCTION
  251. JPressing the "down arrow" when in the "Trace" mode will cause the current J
  252. Hinstruction to be skipped. The word "SKIP" is displayed and the program >
  253. counter is automatically positioned at the next instruction.
  254. TRACING PROGRAMS IN OTHER PERIPHERAL CARDS
  255. HThe ProDev DDT will trace programs in other peripheral cards as long as J
  256. Hthe card does not use a bank switching scheme to fit more than 2K bytes I
  257. Gin the 2K ROM space. The best way to find out if it works is to try it L
  258. Jand see. The slot number of the other peripheral card should be in memory =
  259. location $7F8. Enter the ProDev DDT by pressing the button.
  260. TRACING PROGRAMS IN the $C800 - $CFFF MEMORY SPACE.
  261. IThe $C800 - $CFFF memory space is shared by all the peripheral cards and J
  262. His reserved for their use (The Apple also uses this space). If you wish L
  263. Jto trace a program on a peripheral card which resides in this space it is (
  264. necessary to take the following steps:
  265. Fa) Set the memory location $7F8 (MSLOT) to the number $Cn of the card 
  266. being traced.
  267. Gb) Use the "GO" command to run a "do nothing" program. (E.G. $2000 JMP     
  268. $2000).
  269. Jc) Now press the BUTTON INTERRUPT. This saves the $Cn number of $7F8 (the H
  270. Factive peripheral card) to the ProDev DDT's RAM. This is the card the H
  271. ProDev DDT will access when told to access $C800 - $CFFF memory space.
  272.